interface Waiter15 {
  anjiao: boolean;
  say: () => {};
}
interface Teacher15 {
  anjiao: boolean;
  skill: () => {};
}

function judgeWho15(animal: Waiter15 | Teacher15) {
  if (animal.anjiao) {
    (animal as Teacher15).skill();
  } else {
    (animal as Waiter15).say();
  }
}

function judgeWho2(animal: Waiter15 | Teacher15) {
  if ("skill" in animal) {
    animal.skill();
  } else {
    animal.say();
  }
}

function Add15(first: string | number, second: string | number) {
  if (typeof first === "string" || typeof second === "string") {
    return `${first}${second}`;
  }
  return first + second;
}

console.log(Add15(1, "s"));

class NumberObj15 {
  count: number = 0;
}
function addObj15(first: object | NumberObj15, second: object | NumberObj15) {
  if (first instanceof NumberObj15 && second instanceof NumberObj15) {
    return first.count + second.count;
  }
  return 0;
}
